import { IPSDERBase } from '../dataentity/der/ipsderbase';
import { IPSSysEAIDER } from './ipssys-eaider';
import { IPSSysEAIElement } from './ipssys-eaielement';
import { IPSSysEAIElementRE } from './ipssys-eaielement-re';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysEAIDERImpl extends PSModelObjectImpl implements IPSSysEAIDER {
  get codeName(): string {
    return this.M.codeName;
  }

  get dERTag(): string {
    return this.M.dERTag;
  }

  get dERTag2(): string {
    return this.M.dERTag2;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psder: IPSDERBase | null = null;

  getPSDER(): IPSDERBase | null {
    if (this.psder != null) return this.psder;
    const value = this.M.getPSDER;
    if (value == null) {
      return null;
    }
    this.psder = this.getPSModel4('dataentity.der.IPSDERBase', value, 'getPSDER') as IPSDERBase;
    return this.psder;
  }

  get psDER(): IPSDERBase | null {
    return this.getPSDER();
  }

  getPSDERMust(): IPSDERBase {
    const value = this.getPSDER();
    if (value == null) {
      throw new Error('未指定实体关系');
    }
    return value;
  }

  protected pssyseaielementre: IPSSysEAIElementRE | null = null;

  getPSSysEAIElementRE(): IPSSysEAIElementRE | null {
    if (this.pssyseaielementre != null) return this.pssyseaielementre;
    const value = this.M.getPSSysEAIElementRE;
    if (value == null) {
      return null;
    }
    const ipssyseaielement = this.getParentPSModelObject('eai.IPSSysEAIElement') as IPSSysEAIElement;
    if (ipssyseaielement != null) {
      this.pssyseaielementre = ipssyseaielement.findPSSysEAIElementRE(value);
    }
    return this.pssyseaielementre;
  }

  get psSysEAIElementRE(): IPSSysEAIElementRE | null {
    return this.getPSSysEAIElementRE();
  }

  getPSSysEAIElementREMust(): IPSSysEAIElementRE {
    const value = this.getPSSysEAIElementRE();
    if (value == null) {
      throw new Error('未指定集成元素引用属性');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysEAIDERImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'eai.IPSEAIDER' || cls == 'eai.IPSSysEAIDER') return true;
    return super.instanceof(cls);
  }
}
